@echo off
chcp 65001 >nul
echo 开始下载前端库...

REM 创建目录结构
if not exist "src\main\resources\static\lib\bootstrap\css" mkdir "src\main\resources\static\lib\bootstrap\css"
if not exist "src\main\resources\static\lib\bootstrap\js" mkdir "src\main\resources\static\lib\bootstrap\js"
if not exist "src\main\resources\static\lib\bootstrap-icons\font\fonts" mkdir "src\main\resources\static\lib\bootstrap-icons\font\fonts"
if not exist "src\main\resources\static\lib\npm" mkdir "src\main\resources\static\lib\npm"

REM 下载 Bootstrap CSS
echo 下载 Bootstrap CSS...
powershell -Command "Invoke-WebRequest -Uri 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css' -OutFile 'src\main\resources\static\lib\bootstrap\css\bootstrap.min.css'"

REM 下载 Bootstrap JavaScript
echo 下载 Bootstrap JavaScript...
powershell -Command "Invoke-WebRequest -Uri 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js' -OutFile 'src\main\resources\static\lib\bootstrap\js\bootstrap.bundle.min.js'"

REM 下载 Bootstrap Icons CSS
echo 下载 Bootstrap Icons CSS...
powershell -Command "Invoke-WebRequest -Uri 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css' -OutFile 'src\main\resources\static\lib\bootstrap-icons\font\bootstrap-icons.css'"

REM 下载 Bootstrap Icons 字体文件
echo 下载 Bootstrap Icons 字体文件...
powershell -Command "Invoke-WebRequest -Uri 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/fonts/bootstrap-icons.woff' -OutFile 'src\main\resources\static\lib\bootstrap-icons\font\fonts\bootstrap-icons.woff'"
powershell -Command "Invoke-WebRequest -Uri 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/fonts/bootstrap-icons.woff2' -OutFile 'src\main\resources\static\lib\bootstrap-icons\font\fonts\bootstrap-icons.woff2'"

REM 下载 Chart.js
echo 下载 Chart.js...
powershell -Command "Invoke-WebRequest -Uri 'https://cdn.jsdelivr.net/npm/chart.js' -OutFile 'src\main\resources\static\lib\npm\chart.js'"

echo.
echo 所有前端库下载完成！
echo.
echo 下载的文件：
echo - Bootstrap CSS: src\main\resources\static\lib\bootstrap\css\bootstrap.min.css
echo - Bootstrap JS: src\main\resources\static\lib\bootstrap\js\bootstrap.bundle.min.js
echo - Bootstrap Icons CSS: src\main\resources\static\lib\bootstrap-icons\font\bootstrap-icons.css
echo - Bootstrap Icons Fonts: src\main\resources\static\lib\bootstrap-icons\font\fonts\
echo - Chart.js: src\main\resources\static\lib\npm\chart.js
pause 